﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonEmpCertPrint.aspx.cs"
    Inherits="RN.ERP.Web.Person.PersonEmpCertPrint" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Styles/EmpCertPrint.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin: 0px;">
    <form id="form1" runat="server">
    <div id="d_codel" class="labal" onclick="isme(this);">
        执业编号：
    </div>
    <div id="d_codet" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_codet" runat="server"></asp:Literal>
    </div>
   
    <div id="d_zyl" class="labal" onclick="isme(this);">
        现从事专业：
    </div>
    <div id="d_zylZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_zylZ" runat="server"></asp:Literal>
    </div>
    <div id="d_zy1" class="labal" onclick="isme(this);">
        1、
    </div>
    <div id="d_zy1Z" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_zy1Z" runat="server"></asp:Literal>
    </div>
    <div id="d_zy2" class="labal" onclick="isme(this);">
        2、
    </div>
    <div id="d_zy2Z" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_zy2Z" runat="server"></asp:Literal>
    </div>
    <div id="d_cydw" class="labal" onclick="isme(this);">
        执业单位：
    </div>
    <div id="d_cydwZ" class="text" style="" onclick="isme(this);">
        <asp:Literal ID="lbld_cydwZ" runat="server"></asp:Literal>
    </div>
    <div id="d_xm" class="labal" onclick="isme(this);">
        姓 名：
    </div>
    <div id="d_xmZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_xmZ" runat="server"></asp:Literal>
    </div>
    <div id="d_xb" class="labal" onclick="isme(this);">
        性 别：
    </div>
    <div id="d_xbZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_xbZ" runat="server"></asp:Literal>
    </div>
    <div id="d_sfzh" class="labal" onclick="isme(this);">
        身份证号：
    </div>
    <div id="d_sfzhZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_sfzhZ" runat="server"></asp:Literal>
    </div>
    <div id="d_xl" class="labal" onclick="isme(this);">
        学历（学位）：
    </div>
    <div id="d_xlZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_xlZ" runat="server"></asp:Literal>
    </div>
    <div id="d_sxzy" class="labal" onclick="isme(this);">
        所学专业：
    </div>
    <div id="d_sxzyZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_sxzyZ" runat="server"></asp:Literal>
    </div>
    <div id="d_zc" class="labal" onclick="isme(this);">
        技术职称：
    </div>
    <div id="d_zcZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_zcZ" runat="server"></asp:Literal>
    </div>
    <div id="d_yxqz" class="labal" onclick="isme(this);">
        申报证件名称：
    </div>
    <div id="d_yxqzZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_yxqzZ" runat="server"></asp:Literal>
    </div>
    <div id="d_zsbh" class="labal" onclick="isme(this);">
        申报证书编号：
    </div>
    <div id="d_zsbhZ" class="text" onclick="isme(this);">
        <asp:Literal ID="lbld_zsbhZ" runat="server"></asp:Literal>
    </div>
    <div id="d_fzbm" class="labal" onclick="isme(this);">
        发证机关：
    </div>
    <div id="fzjgt" class="text" onclick="isme(this);">
        <asp:Literal ID="lblfzjgt" runat="server"></asp:Literal>
    </div>
    <div id="d_fzrq" class="labal" onclick="isme(this);">
        发证日期：
    </div>
    <div id="d_fzrqZ" class="text" onclick="isme(this);">
       <asp:Literal ID="lbld_fzrqZ" runat="server"></asp:Literal>
    </div>
    <table style="top: 600px; position: absolute;">
        <tr>
            <td>
                <a id="pr" onclick="this.style.display='none';pr();" href="#">打印</a>
            </td>
        </tr>
    </table>
    <div id="control" class="control">
        <div id="UP" class="controler">
            ↑
        </div>
        <div id="LEFT" class="controler">
            ←
        </div>
        <div class="clear">
        </div>
        <div id="DOWN" class="controler">
            ↓
        </div>
        <div id="RIGHT" class="controler">
            →
        </div>
        <div id="put" class="controler" onclick="dododo();">
            显示位置
        </div>
        <textarea id="all">可按住shift与ctrl换挡调整</textarea>
        <div class="clear">
        </div>
        
    </div>
    </form>
</body>
<script language="JavaScript" type="text/javascript">

    //
    var $ = function (str) {
        return document.getElementById(str);

    }


    //活动的div
    var activer;
    //一下移动的距离 px
    var step = 10;
    //键盘或鼠标的状态
    var keyStatus = "";
    //就是timer
    var iTimer;


    //设定活动者，当然也可以清空活动者
    function setActiver(o) {

        if (activer != undefined) {
            activer.style.border = "";
        }

        activer = o;

        if (activer != undefined) {
            activer.style.border = "1px solid black";
        }
        window.clearInterval(iTimer);
        iTimer = undefined;
    }



    //我就是活动者
    function isme(o) {
        if (o == activer) {
            setActiver(undefined);
        }
        else {
            setActiver(o);
        }
    }



    //为了兼容火狐的取样问题 详细的自己狗狗吧 ：style只能取行样式 currentStyle能取那种 但不兼容火狐
    function getCurrentStyleTop(o) {
        if (document.all) {
            return o.currentStyle.top;
        }
        else {
            return window.getComputedStyle(o, null).getPropertyValue('top');
        }
    }

    function getCurrentStyleLeft(o) {
        if (document.all) {
            return o.currentStyle.left;
        }
        else {
            return window.getComputedStyle(o, null).getPropertyValue('left');
        }
    }


    //往左走
    function ActiveLEFT() {

        if (activer.style.left != "") {
            activer.style.left = parseInt(activer.style.left) - step + "px";
        }
        else {
            activer.style.left = parseInt(getCurrentStyleLeft(activer)) - step + "px";
        }
    }

    //往上走
    function ActiveUP() {
        if (activer.style.top != "") {
            activer.style.top = parseInt(activer.style.top) - step + "px";
        }
        else {
            activer.style.top = parseInt(getCurrentStyleTop(activer)) - step + "px";
        }
    }


    //往右走
    function ActiveRIGHT() {
        if (activer.style.left != "") {
            activer.style.left = parseInt(activer.style.left) + step + "px";
        }
        else {
            activer.style.left = parseInt(getCurrentStyleLeft(activer)) + step + "px";
        }

    }



    //往下走
    function ActiveDOWN() {

        if (activer.style.top != "") {
            activer.style.top = parseInt(activer.style.top) + step + "px";
        }
        else {
            activer.style.top = parseInt(getCurrentStyleTop(activer)) + step + "px";
        }

    }




    //页面按键事件出发后后 处理案件
    function keydown(e) {
        if (activer == undefined)
            return;
        var key = 0
        e = e || event;
        key = e.keyCode || e.which || e.charCode;

        if (key == 27) {
            setActiver(undefined);
            return;
        }


        switch (key) {
            case 17:
                step = 100;
                return; case 16:
                step = 2;
                return;
        }



        if (iTimer != undefined)
            return;

        switch (key) {
            case 37:
                iTimer = window.setInterval("ActiveLEFT()", 50);
                return; case 38:
                iTimer = window.setInterval("ActiveUP()", 50);
                return; case 39:
                iTimer = window.setInterval("ActiveRIGHT()", 50);
                return; case 40:
                iTimer = window.setInterval("ActiveDOWN()", 50);
                return;
        }

    }


    //鼠标点击箭头后 处理案件
    function mousedown(e) {
        if (activer == undefined)
            return;
        if (iTimer != undefined)
            return;
        e = (e) ? e : ((window.event) ? window.event : "");
        var t = (e.target) ? e.target : e.srcElement;

        iTimer = window.setInterval("Active" + t.id + "()", 50);
    }





    //当案件抬起时
    function keymouseup(e) {
        window.clearInterval(iTimer);
        iTimer = undefined;
        e = e || event;
        key = e.keyCode || e.which || e.charCode;
        if (key == 17 || key == 16) {

            step = 10;

        }
    }




    function init() {

        $("LEFT").onmousedown = mousedown;
        $("UP").onmousedown = mousedown;
        $("RIGHT").onmousedown = mousedown;
        $("DOWN").onmousedown = mousedown;


        $("LEFT").onmouseup = keymouseup;
        $("UP").onmouseup = keymouseup;
        $("RIGHT").onmouseup = keymouseup;
        $("DOWN").onmouseup = keymouseup;


        window.document.onkeydown = keydown;
        window.document.onkeyup = keymouseup;

    }

    function setCookie(c_name, value, expiredays) {
        var exdate = new Date()
        exdate.setDate(exdate.getDate() + expiredays)
        document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
    }


    window.onload = init;


    function dododo() {
        var x = document.getElementsByTagName("div");
        var str = "";
        for (var i = 0; i < x.length; i++) {
            str += "ID" + x[i].id + "\t" + "左坐标：" + getCurrentStyleLeft(x[i]) + "\t" + "上坐标:" + getCurrentStyleTop(x[i]);
            str += "\t" + "变更后左坐标:" + x[i].style.left + "\t" + "变更后上坐标:" + x[i].style.top;
            str += "\r\n";
        }
       
        alert(str);
        //            var getActiveXObject, getFile, someMessage,f;
        //                        getAXO = new ActiveXObject("Scripting.FileSystemObject");
        //            getF = getAXO.GetFile("D:\\PrintRecord.txt");
        //            someMessage = "FileName:" + getF.Name + "Filesize:" + getF.size + " bytes.";
        //            f = getAXO.OpenTextFile("D:\\PrintRecord.txt", 8, true);
        //            f.WriteLine(str);
        //            f.Close();        
        //            alert("保存成功");

        $('all').innerHTML = str;
    }


    function pr() {

        var x = document.getElementsByTagName("div");
        var str = "";

        for (var i = x.length - 1; i >= 0; i--) {
            if (x[i].className != "text") {
                x[i].parentNode.removeChild(x[i]);
                //x[i].style.display = "none";
            }
            else {

                if (x[i].style.left != "") {
                    x[i].style.left = parseInt(x[i].style.left) - 100 + "px";
                }
                else {
                    x[i].style.left = parseInt(getCurrentStyleLeft(x[i])) - 100 + "px";
                }
            }
        }


        window.print();
    }
</script>
</html>
